﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>商户设置</title>
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/demo.css">
    <link href="~/Content/Styles/Manage_Order.css" rel="stylesheet" />
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.2/jquery.easyui.min.js"></script>
    <script src="~/Content/jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js"></script>
    <script src="~/Content/jquery-easyui-1.4.2/jquery.Jcrop.js"></script>
    <link href="~/Content/Script/jquery.Jcrop.css" rel="stylesheet" />
    <script>
        $(function () {
            //initTable();
            mertype();
            $("#xiugai").linkbutton('disable');
            $('#xianshiPic').dialog({
                onClose: function () {
                    $("#fileDiv").remove();
                    $("#tp1Div").remove();
                    $("#picwenjian1").hide();
                }
            });
            var date;
        });

        var filePath = "";//图片路径
        //初始化表格  
        function initTable() {
            $('#load').datagrid({
                iconCls: 'icon-user',
                loadMsg: '数据加载中...',
                nowrap: true,
                autoRowHeight: true,
                striped: true,
                url: '/MerSet/getmer',
                sortName: 'MerID',
                sortOrder: 'asc',
                border: true,
                remoteSort: false,
                idField: 'MerID',
                pageSize: 10,
                singleSelect: true,
                pagination: true,
                rownumbers: true,
                columns: [[
					{ field: 'MerID', title: '商户编号', width: 100, sortable: true, align: 'center' },
					{
					    field: 'MerID2', title: '操作', width: 100, sortable: true, align: 'center', formatter: function (value, row) {
					        return '<a href="#" onclick="downloadPic(' + row.MerID + ')">上传照片</a>';
					    }
					},
					{ field: 'MerName', title: '商户名称', width: 250, sortable: true, align: 'center' },
                    { field: 'DictName', title: "商户类型", width: 100, sortable: true, align: 'center', },
                    { field: 'MerAdr', title: "商户地址", width: 250, sortable: true, align: 'center' },
                    { field: 'MerCall', title: "商户联系电话", width: 150, sortable: true, align: 'center' },
                    {
                        field: 'IsRet', title: '是否允许退订', width: 100, sortable: true, align: 'center', formatter: function (isret) {
                            if (isret == 1) {
                                return '是';
                            } else {
                                return '否';
                            }
                        }
                    },
                { field: 'DelMaxMon', title: '配送起步价', width: 100, sortable: true, align: 'center' },
                { field: 'DelFormMon', title: '配送费用', width: 100, sortable: true, align: 'center' },
                ]],
                toolbar: '#tb'
            });
        }
        //获取该商户图片
        function downloadPic(MerID) {
            $("#merID_pic").text(MerID);
            $("#fileToUpload").val("");
            //$("#uploadFile").hide();
            
            $("#tishiyu").html("当前图片");
            //$("#tp1").attr("src", "");
            var file = "<div id=\"tp1Div\" align=\"center\" style=\"margin:auto;width:300px;padding: 10px;\"><img id=\"tp1\" style=\"border-style:solid; border-width:1px; border-color:#000;\" src=\"~/Content/img/小象.jpg\" /></div>"
              + "<div id=\"fileDiv\" align=\"center\" style=\"padding: 10px;\"><input  id=\"f\" onchange=\"imgFun(this.id, this.value, this.files)\" type=\"file\" /></div>";

            //$.post("/MerSet/Image?id=" + MerID, function (src) {
            //    gaib(src);
            //})
            $.get("/MerSet/getMerPhoto?MerID=" + MerID, function (data) {
                console.log(data);
                var myDate = new Date();
                var shij = myDate.getTime();
                $("#tp1").attr("src", data + "?" + shij);
                //    $("#UploadPic").dialog("open").dialog("setTitle", "上传图片");
            });
            $("#picwenjian").prepend(file);
            $("#xianshiPic").dialog("open");
        };

        function imgFun(id, value, fi) {
            $("#picwenjian1").show()
            $("#tishiyu").html("请选择要上传的部分");
            var fielObj = document.getElementById(id)
            var aa = value;
            if (aa.match(/.jpg|.gif|.png|.bmp/i)) {
                console.log(1);
            }
            var fiel = fi[0];
            console.log(fiel);
            console.log(fielObj);
            var img1 = document.getElementById("tp1")
            //var img2 = document.getElementById("tp2")
            var windowURL = window.URL || window.webkitURL;
            console.log(windowURL);
            var dataURL = windowURL.createObjectURL(fi[0]);
            img1.src = dataURL;
            //img2.src = dataURL;
            console.log(img1.src);
            $('#tp1').Jcrop({
                bgFade: true,
                onSelect: updatePreview,
                //onSelect: gaib,
                aspectRatio: 1.3,
                //allowSelect: false,
                //allowResize: false,
                //maxSize: [120, 120],
                minSize: [230, 230],
                boxWidth: 320,
                //boxHeight:350,
                getScaleFactor: [700, 300],
                setSelect: [230, 230, 0, 0],

            });
            console.log("hi");

        };

        function updatePreview(c) {
            wenjian = document.getElementById('f').files[0].name;
            date = {
                x: Math.ceil(c.x),
                y: Math.ceil(c.y),
                w: Math.ceil(c.w),
                h: Math.ceil(c.h),
                pw: Math.ceil($('#tp1').width()),
                ph: Math.ceil($('#tp1').height()),
                t: wenjian,
                id: $("#merID_pic").text(),
            };
            console.log(date);
        };

        function gaib(c) {
            setTimeout(function () {
                var xsb = c.split('\\')[3];
                var xsb2 = c.split('\\')[4];
                var myDate = new Date();
                var shij = myDate.getTime();
                $("#tp1").attr("src", "/" + xsb + "/" + xsb2 + "?" + shij);
            }, 500)

        }

        function quedPic() {

            var picname = document.getElementById('f').files[0];
            var fd = new FormData();
            var xhr = new XMLHttpRequest();
            fd.append("fileToUpload", picname);
            fd.append("id", $("#merID_pic").text());
            xhr.open("POST", "/MerSet/ToLead");
            xhr.send(fd);
            setTimeout(function () {
                if (date.w >= 230 || date.h >= 230) {
                    $.post("/MerSet/SaveImg", date, function (da) {
                        if (da = 1) {
                            uploadFile(date.t);
                        };
                    });
                } else {
                    alert("请选择图片进行裁剪");
                }
            },200);            
        };

        //修改用户对话框
        function UpdateClick() {
            var UpdateID = $("#load").datagrid("getSelections");
            if (UpdateID.length == 1) {
                $("#UpdateMerDialog").dialog("open").dialog("setTitle", "修改商户设置");
                BingDetails();
            }
            else {
                $.messager.alert("友情提示", "每次只能修改一行数据，你已经选择了<font color='red' size='6'>" + UpdateID.length + "</font>行");
            }
        }

        //允许消费范围
        function MerDep() {
            $('#merdep').combotree({
                url: "/MerSet/getdep",
                method: 'get',
                multiple: true,
            });
        }
        var MerID;//定义全局商户编号
        var MerPic;
        var LastChanMon;
        var OverChanMon;
        var DelTime;
        var MerState;
        var SalesCount;
        var EvaCount;
        var StarCount;
        var IsCashPay;
        var newsort;
        //获取用户信息绑定
        function BingDetails() {
            MerDep();
            var datas = $("#load").datagrid("getSelections")[0];
            console.log(datas);
            MerID = $("#load").datagrid("getSelections")[0].MerID;
            MerPic = $("#load").datagrid("getSelections")[0].MerPic;
            LastChanMon = $("#load").datagrid("getSelections")[0].LastChanMon;
            OverChanMon = $("#load").datagrid("getSelections")[0].OverChanMon;
            DelTime = $("#load").datagrid("getSelections")[0].DelTime;
            MerState = $("#load").datagrid("getSelections")[0].MerState;
            SalesCount = $("#load").datagrid("getSelections")[0].SalesCount;
            EvaCount = $("#load").datagrid("getSelections")[0].EvaCount;
            StarCount = $("#load").datagrid("getSelections")[0].StarCount;
            IsCashPay = $("#iscashpay").combobox('setValue', datas.IsCashPay);
            filePath = datas.MerPic;
            $("#mername").textbox('setValue', datas.MerName);
            $("#meradr").textbox('setValue', datas.MerAdr);
            $("#mercall").textbox('setValue', datas.MerCall);
            $("#delformmon").textbox('setValue', datas.DelFormMon);
            $("#delmaxmon").textbox('setValue', datas.DelMaxMon);
            $("#deltypename").textbox('setValue', datas.DictName);
            $("#deltime").textbox('setValue',datas.DelTime);
            $("#deltype").text(datas.DelType);
            $("#mertxt").textbox('setValue', datas.MerTxt);
            $("#merdep").combotree('setValue', datas.MerDep);
            $("#isret").combobox('setValue', datas.IsRet);
            $("#Greater").textbox('setValue', datas.Greater);
            $("#HowCount").textbox('setValue', datas.HowCount);
            $("#AddMoney").textbox('setValue', datas.AddMoney / 100);
            $("#DelMonTxt").textbox('setValue', datas.DelMonTxt);
            var subsort = $("#load").datagrid("getSelections")[0].MerSort;
            newsort = subsort.substr(0, 1);
            $("#sleid").combobox('setValue', newsort);

        }

        //修改用户绑定事件
        function BindUpdateMerClickEvent() {
                //首先判断前台的验证是否通过
                var valid = $('#updateController').form('validate');
                if (valid == false) {
                    return false;
                }
                var paisongBZ = $("#DelMonTxt").textbox('getValue');
                
                if ($.trim(paisongBZ) == "" || $.trim(paisongBZ) == null) {
                    $.messager.alert("友情提示", "派送费用说明不能为空！")
                    return false;
                }
                var postdata = {
                    MerID: MerID,
                    MerPic: MerPic,
                    LastChanMon: LastChanMon,
                    OverChanMon: OverChanMon,
                    DelTime: DelTime,
                    MerState: MerState,
                    SalesCount: SalesCount,
                    EvaCount: EvaCount,
                    StarCount: StarCount,
                    IsCashPay: $("#iscashpay").combobox('getValue'),
                    MerAdr: $("#meradr").textbox('getValue'),
                    MerName: $("#mername").textbox('getValue'),
                    DelType: $("#deltype").text(),
                    DelTime:$("#deltime").textbox('getValue'),
                    MerCall: $("#mercall").textbox('getValue'),
                    DelFormMon: $("#delformmon").textbox('getValue'),
                    DelMaxMon: $("#delmaxmon").textbox('getValue'),
                    MerDep: $("#merdep").combotree('getValue'),
                    IsRet: $("#isret").combobox('getValue'),
                    MerSort: newsort,
                    MerPic: filePath,
                    MerTxt: $("#mertxt").textbox('getValue'),
                    Greater: $("#Greater").textbox('getValue'),
                    HowCount: $("#HowCount").textbox('getValue'),
                    AddMoney: $("#AddMoney").textbox('getValue') * 100,
                    DelMonTxt: $("#DelMonTxt").textbox('getValue'),
                };
                //console.log(postdata.AddMoney);
                //alert(true);
                //使用异步实现修改用户信息
                $.post("/MerSet/updatemerset", postdata, function (date) {
                    if (date == "OK") {
                        $("#UpdateMerDialog").dialog('close');
                        $.messager.alert("提示","修改成功");
                        $("#load").datagrid('reload');
                    }
                    else {
                        $.messager.alert("友情提示", "修改失败，请检查");
                    }
                });
        }
        //商户类型
        function mertype() {
            $.get("/MerSet/getmertype", {}, function (database) {
                $('#DelType').combobox({
                    valueField: 'DictKey',
                    textField: 'DictName',
                    value: '-8989',
                    text: '全部',
                    data: database
                });
            })
        }

        //搜索
        function Search() {
            var DelType = $('#DelType').combobox('getValue');
            var MerName = $('#MerName').textbox('getValue');
            var MerAdr = $('#MerAdr').textbox('getValue');
            if (DelType != "" || MerName != "" || MerAdr != "") {
                $("#xiugai").linkbutton('enable');
                $('#load').datagrid({
                    iconCls: 'icon-user',
                    loadMsg: '数据加载中...',
                    nowrap: true,
                    autoRowHeight: true,
                    striped: true,
                    url: '/MerSet/SearchMer?DelType=' + DelType + "&MerName=" + MerName + "&MerAdr=" + MerAdr,
                    sortName: 'MerID',
                    sortOrder: 'asc',
                    border: true,
                    remoteSort: false,
                    idField: 'MerID',
                    pageSize: 10,
                    singleSelect: true,
                    pagination: true,
                    rownumbers: true,
                    columns: [[
                        { field: 'MerID', title: '商户编号', width: 100, sortable: true, align: 'center' },
                        {
                            field: 'MerID2', title: '操作', width: 100, sortable: true, align: 'center', formatter: function (value, row) {
                                return '<a href="#" onclick="downloadPic(' + row.MerID + ')">上传照片</a>';
                            }
                        },
                        { field: 'MerName', title: '商户名称', width: 250, sortable: true, align: 'center' },
                        { field: 'DictName', title: "商户类型", width: 100, sortable: true, align: 'center', },
                        { field: 'MerAdr', title: "商户地址", width: 250, sortable: true, align: 'center' },
                        { field: 'MerCall', title: "商户联系电话", width: 150, sortable: true, align: 'center' },
                        {
                            field: 'IsRet', title: '是否允许退订', width: 100, sortable: true, align: 'center', formatter: function (isret) {
                                if (isret == 1) {
                                    return '是';
                                } else {
                                    return '否';
                                }
                            }
                        },
                    { field: 'DelMaxMon', title: '配送起步价', width: 100, sortable: true, align: 'center' },
                    { field: 'DelFormMon', title: '配送费用', width: 100, sortable: true, align: 'center' },
                    ]],
                    toolbar: '#tb'
                });
            }
        }

        function sortTable(MerID) {
            $('#sort').datagrid({
                iconCls: 'icon-user',
                loadMsg: '数据加载中...',
                fitColumns: true,
                singleSelect: true,
                nowrap: true,
                autoRowHeight: true,
                striped: true,
                url: '/MerSet/getgrid?MerID=' + MerID,
                sortName: 'DishesID',
                sortOrder: 'asc',
                border: true,
                remoteSort: false,
                idField: 'DishesID',
                pageSize: 10,
                pagination: true,
                rownumbers: true,
                columns: [[
                    { field: 'DishesID', title: 'ID', sortable: true, hidden: true },
                    { field: 'DishesNmae', title: '商品名称', width: 80, sortable: true, align: 'center' },
                    { field: 'MerName', title: '商户名称', width: 80, sortable: true, align: 'center' },
                    { field: 'DishesVol', title: '菜品销量', },

                ]],
                toolbar: [{
                    text: '上移', iconCls: 'icon-add', handler: function () {
                        MoveUp();
                    }
                }, '-', {
                    text: '下移', iconCls: 'icon-remove', handler: function () {
                        MoveDown();
                    }
                }],
            });
        }

        //商品上移
        function MoveUp() {
            var row = $("#sort").datagrid('getSelected');
            var index = $("#sort").datagrid('getRowIndex', row);
            mysort(index, 'up', 'sort');

        }
        //商品下移
        function MoveDown() {
            var row = $("#sort").datagrid('getSelected');
            var index = $("#sort").datagrid('getRowIndex', row);
            mysort(index, 'down', 'sort');

        }
        //
        function mysort(index, type, gridname) {
            if ("up" == type) {
                if (index != 0) {
                    var toup = $('#' + gridname).datagrid('getData').rows[index];
                    var todown = $('#' + gridname).datagrid('getData').rows[index - 1];
                    $('#' + gridname).datagrid('getData').rows[index] = todown;
                    $('#' + gridname).datagrid('getData').rows[index - 1] = toup;
                    $('#' + gridname).datagrid('refreshRow', index);
                    $('#' + gridname).datagrid('refreshRow', index - 1);
                    $('#' + gridname).datagrid('selectRow', index - 1);
                }
            } else if ("down" == type) {
                var rows = $('#' + gridname).datagrid('getRows').length;
                if (index != rows - 1) {
                    var todown = $('#' + gridname).datagrid('getData').rows[index];
                    var toup = $('#' + gridname).datagrid('getData').rows[index + 1];
                    $('#' + gridname).datagrid('getData').rows[index + 1] = todown;
                    $('#' + gridname).datagrid('getData').rows[index] = toup;
                    $('#' + gridname).datagrid('refreshRow', index);
                    $('#' + gridname).datagrid('refreshRow', index + 1);
                    $('#' + gridname).datagrid('selectRow', index + 1);
                }
            }

        }


        //选择自定义排序方式
        function ChangeSort() {
            var getvalue = document.getElementById("sleid").value;
            if (getvalue == 0) {

                document.getElementById("sort").style.display = "block";
                //初始化表格 获取对应商户所有商品
                sortTable(MerID);

            }
            else {
                document.getElementById("sort").style.display = "none";
                function hide() {
                    $("#sort").hide("slow");
                }


            }
        }

        //选择图片
        function fileSelected(sourceId, targetId) {
            if (typeof FileReader == 'undefined') {
                $.messager.alert("请选择图片");
                return;
            }
            var reader = new FileReader();
            reader.onload = function (e) {
                var img = document.getElementById(targetId);
                img.src = this.result;
            }
            reader.readAsDataURL(document.getElementById(sourceId).files[0]);
            var file = document.getElementById('fileToUpload').files[0];
            var fileName = file.name;
            var file_typename = fileName.substring(fileName.lastIndexOf('.'), fileName.length);
            filePath = "/Dishes/" + fileName;
            if (file_typename == '.jpg') {
                //这里限定上传文件文件类型
                if (file) {
                    $("#uploadFile").show();
                    var fileSize = 0;
                    if (file.size > 1024 * 1024) {
                        fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + 'MB';
                    }
                    else {
                        fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + 'KB';
                    }
                }
            } else {
                $("#uploadFile").hide();
                document.getElementById('fileName').innerHTML = "<span style='color:Red'>只能是jpg格式的图片</span>"
            }
        }
        //上传文件
        function uploadFile(name) {
            ///var picname = document.getElementById('fileToUpload').files[0].name;
            var merid_pic = $("#merID_pic").text();
            $.get("/MerSet/ToLoadPic?MerID=" + merid_pic + "&PicName=" + name, function (data) {
                console.log(data);
                if (data == "1") {
                    //$('#dlg_progress').dialog('open');
                    //var fd = new FormData();
                    //fd.append("fileToUpload", document.getElementById('fileToUpload').files[0]);
                    //var xhr = new XMLHttpRequest();
                    //xhr.upload.addEventListener("progress", uploadProgress, false);
                    //xhr.addEventListener("load", uploadComplete, false);
                    //xhr.addEventListener("error", uploadFailed, false);
                    //xhr.addEventListener("abort", uploadCanceled, false);
                    //xhr.open("POST", "/MerSet/ToLead");
                    //xhr.send(fd);
                    //$('#dlg_progress').dialog('close');//关闭进度条
                    $('#xianshiPic').dialog('close');//关闭图片上传界面
                    //$.messager.alert("友情提示", "上传成功！");
                    alert("上传成功");
                    //window.location.href = "/MerSet/index";
                    initTable();
                } else {
                    $.messager.alert("友情提示", data);
                }
            });
        }
        //上传图片进程
        function uploadProgress(evt) {
            if (evt.lengthComputable) {
                var percentComplete = Math.round(evt.loaded * 100 / evt.total);
                $('#progressNumber').progressbar('setValue', percentComplete);

            }
            else {
                document.getElementById('progressNumber').innerHTML = '无法计算';
            }

            //$.messager.alert("友情提示", "上传成功！");
            //$('#dlg_progress').dialog('close');
        }
        //加载异常
        function uploadComplete(evt) {
            /* 服务器返回数据*/
            var message = evt.target.responseText;
            //$.messager.alert(message);
            //location.reload();
        }

        //上传文件失败
        function uploadFailed(evt) {
            $.messager.alert("上传出错.");
        }

        //加载连接异常
        function uploadCanceled(evt) {
            $.messager.alert("上传已由用户或浏览器取消删除连接.");
        }

        //清空文本框中的值
        function ClearText() {
            $("#mername").val(""),
            $("#meradr").val(""),
            $("#mercall").val(""),
            $("#delformmon").val(""),
            $("#delmaxmon").val(""),
            $("#deltypename").val("")
        }
    </script>
    <style>
        .dig-table {
            border: 0px solid black;
            line-height: 32px;
            width: 90%;
        }
    </style>
</head>
<body style="padding: 0;">
    <!--表格加载S-->
    <div>
        <table id="load" style="width: auto;"></table>
    </div>
    <!--表格加载E-->

    <!--修改S-->
    <div id="UpdateMerDialog" class="easyui-dialog" style="width: 620px; padding: 10px 0 10px 10px" closed="true" resizable="true" modal="true" buttons="#dlg-buttons" align="center">
        <form id="updateController" action="/MerSet/updatemerset" method="post" novalidate="novalidate">
            <table class="dig-table">
                <tr>
                    <td class="fr">商户名称：</td>
                    <td>
                        <input id="mername" class="easyui-textbox" readonly="true" style="width: 100px" /></td>
                    <td class="fr">商户类型：</td>
                    <td>
                        <label id="deltype" hidden></label>
                        <input id="deltypename" class="easyui-textbox" readonly="true" style="width: 100px" /></td>
                </tr>
                <tr>
                    <td class="fr">联系电话：</td>
                    <td>
                        <input id="mercall" class="easyui-textbox" style="width: 100px" /></td>
                    <td class="fr">商户地址：</td>
                    <td>
                        <input id="meradr" class="easyui-textbox" readonly="true" style="width: 100px" /></td>
                </tr>
                <tr>
                    <td class="fr">允许消费范围：</td>
                    <td>
                        <input id="merdep" class="easyui-combotree" name="" value="" style="width: 100px" readonly="true" /></td>
                    <td class="fr">平均送餐时间：</td>
                    <td><input class="easyui-textbox" id="deltime"style="width: 50px"/>分钟</td>
                </tr>
                <tr>
                    <td class="fr">是否允许退订：</td>
                    <td>
                        <select id="isret" name="isret" class="easyui-combobox" style="width: 50px">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select></td>
                    <td class="fr">是否允许现金消费：</td>
                    <td>
                        <select id="iscashpay" name="iscashpay" class="easyui-combobox" style="width:50px;">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select></td>
                </tr>
                <tr>
                    <td class="fr">配送起步价：</td>
                    <td>
                        <input id="delmaxmon" class="easyui-textbox" style="width: 50px" />&nbsp;元</td>
                    
                    <td class="fr">@*配送费用：*@</td>
                    <td>
                        @*<input id="" class="easyui-textbox" style="width: 50px" />&nbsp;元*@</td>
                </tr>
                <tr>

                    <td class="fr">商户介绍：</td>
                    <td colspan="3">
                        <input id="mertxt" class="easyui-textbox" data-options="multiline:true" style="width: 90%; height: 50px"></td>
                </tr>
                <tr>
                    <td  class="fr">配送费：</td>
                    <td><input id="delformmon" class="easyui-textbox" style="width: 50px" />&nbsp;元</td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="4" style="color:red;text-align:center">配送费超额计算规则</td>
                </tr>
                <tr>
                    <td class="fr" style="margin-right:25px">条件</td>
                    <td style="text-align:center">超出份数</td>
                    <td>加收金额</td>
                    <td></td>
                </tr>
                <tr>
                    <td  class="fr"><input id="Greater" class="easyui-textbox" style="width: 50px" />&nbsp;份</td>
                    <td  style="text-align:center"><input id="HowCount" class="easyui-textbox" style="width: 50px" />&nbsp;份</td>
                    <td><input id="AddMoney" class="easyui-textbox" style="width: 50px" />&nbsp;元</td>
                    <td></td>
                </tr>
                <tr>
                    <td class="fr">派送费用说明：<p style="color:red">(不能为空)</p></td>
                    <td colspan="3">
                        <input id="DelMonTxt" class="easyui-textbox" data-options="multiline:true" style="width: 90%; height: 50px">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <center><a id="btnUpdate" class="easyui-linkbutton" iconcls="icon-ok" onclick="BindUpdateMerClickEvent()">修改</a></center>
                    </td>
                    <td>
                        <center><a class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#UpdateMerDialog').dialog('close')">取消</a></center>
                    </td>
                    <td></td>
                </tr>
                
            </table>
            <!--<table border="0">
                <tr style="line-height: 24px;">
                    <td>商户名称：<input id="mername" class="easyui-textbox" readonly="true" style="width: 100px" /></td>
                    <td rowspan="6">
                        <div id="localImag">
                            <img id="div_img" alt="" onclick="" src="" width="200" height="200" />
                        </div>

                    </td>
                </tr>
                <tr>
                    <td>商户地址：<input id="meradr" class="easyui-textbox" readonly="true" style="width: 100px" /></td>
                </tr>
                <tr>
                    <td>商户类型：<input id="deltype" class="easyui-textbox" readonly="true" style="width: 100px" /></td>
                </tr>
                <tr>
                    <td>允许消费范围：<input id="merdep" class="easyui-combotree" name="" value="" style="width: 80px" readonly="true" /></td>
                </tr>
                <tr>
                    <td>联系电话：<input id="mercall" class="easyui-textbox" style="width: 100px" /></td>
                </tr>
                <tr>
                    <td>配送费用：<input id="delformmon" class="easyui-textbox" style="width: 80px" />&nbsp;元</td>
                </tr>
                <tr>
                    <td>配送起步价：<input id="delmaxmon" class="easyui-textbox" style="width: 70px" />&nbsp;元</td>
                    <td>
                        <input id="fileToUpload" style="width: 224px; border: 1px solid #95B8E7" name="pic" multiple="multiple" onchange="fileSelected(this.id,'div_img');" type="file" />
                        <a id="uploadFile" style="display: none" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="uploadFile()">上传并导入</a>
                    </td>
                </tr>
                <tr>
                    <td>是否允许退订：
                        <select id="isret" name="isret" class="easyui-combobox" style="width: 50px">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select>
                    </td>
                    <td>
                        <div id="fileName"></div>
                    </td>
                </tr>
                <tr>
                    <td>是否允许现金消费：
                        <select id="iscashpay" name="iscashpay" class="easyui-combobox">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select>
                    </td>
                    <td>
                        <div id="dlg_progress" class="easyui-dialog" data-options="modal:true,iconCls:'icon-edit',closed:true" style="width: 300px; padding: 10px 50px 50px 10px;">
                            <div id="progressNumber" class="easyui-progressbar" style="width: 200px;">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>商品排序方式：
                        <select id="sleid" name="sleid" onchange="ChangeSort()">
                            <option value="1">按平均星级</option>
                            <option value="2">按销售总额数量</option>
                            <option value="3">按商品被评论总数量</option>
                            <option value="0">自定义</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">商户介绍：<input id="mertxt" class="easyui-textbox" data-options="multiline:true" style="width: 90%; height: 50px"></td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table id="sort" style="display: none; width: auto;">
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <center><a id="btnUpdate" class="easyui-linkbutton" iconcls="icon-ok" onclick="BindUpdateMerClickEvent()">修改</a></center>
                    </td>
                    <td>
                        <center><a class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#UpdateMerDialog').dialog('close')">取消</a></center>
                    </td>
                </tr>

            </table>-->

        </form>
    </div>
    <!--修改E-->
    <!--图片上传s-->
    <div id="UploadPic" class="easyui-dialog" style="width: 500px; padding: 30px" closed="true" resizable="true" modal="true" buttons="#dlg-buttons" align="center">
        <table>
            <tr>
                <td colspan="2" style="text-align: center;">
                    <label id="merID_pic" hidden></label>
                    <div id="localImag">
                        <img id="div_img" alt="" onclick="" src="" width="200" height="200" />
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <input id="fileToUpload" style="width: 224px; border: 1px solid #95B8E7" name="pic" multiple="multiple" onchange="fileSelected(this.id,'div_img');" type="file" />
                </td>
                <td>
                    <a id="uploadFile" style="display: none" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="uploadFile()">上传并导入</a>
                </td>
            </tr>
        </table>
    </div>
    <!--图片上传e-->
    <!--排序工具栏S-->
    @*<div id="tbsort">
        <a class="easyui-linkbutton" onclick="MoveUp()" icon="icon-up">上移</a>
        <a class="easyui-linkbutton" onclick="MoveDown()" icon="icon-down">下移</a>
    </div>*@
    <!--排序工具栏E-->

    <!--工具栏S-->
    <div id="tb" style="padding: 5px; height: auto">
        <div style="margin-bottom: 5px">
            <a href="#" id="xiugai" class="easyui-linkbutton" iconcls="icon-edit" onclick="UpdateClick()">修改商户信息</a>
            &nbsp;
            查询条件：&nbsp;
            商户类型:&nbsp;<input id="DelType" class="easyui-combobox" style="width: 100px" />&nbsp;
			商户名称:&nbsp;<input id="MerName" class="easyui-textbox" style="width: 100px" />&nbsp;
            商户地址:&nbsp;<input id="MerAdr" class="easyui-textbox" style="width: 120px">&nbsp;
			<a class="easyui-linkbutton" onclick="Search()" iconcls="icon-search">查询</a>
        </div>
    </div>
    <!--工具栏E-->
    <div id="xianshiPic" class="easyui-dialog" style="width:500px;height:400px;" closed="true" modal="true" title="图片" resizable="true">
        <div></div>
        <p id="tishiyu" align="center" style="margin: 0 auto;padding: 10px;">请在图片上选取要上传的部分</p>
        @*<div id="tp1Div" align="center" style="margin:auto;width:300px;padding: 10px;"><img id="tp1" style="border-style:solid; border-width:1px; border-color:#000;" src="~/Content/img/小象.jpg" /></div>*@
        @*<div align="center" style="padding: 10px;"><input type="file" /></div>*@
        <div id="picwenjian"></div>
        <div id="picwenjian1" style="display:none" align="center"><button onclick="quedPic()" style="margin:0px 20px;">确定</button>@*<button style="margin:0px 20px ;">关闭</button>*@</div>
    </div>

</body>
</html>
